import java.util.HashMap;
import java.util.Map;

class Solution1 {
    // 这道题有重复字母
    public boolean CheckPermutation(String s1, String s2) {
        char[] str1 = s1.toCharArray();
        char[] str2 = s2.toCharArray();
        Map<Character, Integer> hashMap1 = new HashMap<>();
        for (int i = 0; i < str1.length; i++) {
            hashMap1.put(str1[i], hashMap1.getOrDefault(str1[i], 0) + 1);
        }

        Map<Character, Integer> hashMap2 = new HashMap<>();
        for (int i = 0; i < str2.length; i++) {
            hashMap2.put(str2[i], hashMap2.getOrDefault(str2[i], 0) + 1);
        }
        if(hashMap1.equals(hashMap2)){
            return true;
        }
        return false;
    }

    public static void main(String[] args) {

    }
}

